package com.woniuxy.commons.service;

import com.woniuxy.commons.dto.CourseDto;
import com.woniuxy.commons.entity.*;
import com.woniuxy.commons.factory.RemoteCourseServiceFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 吴毛伟
 * @date:2020/7/20 10:11
 * @description:
 */
@FeignClient(name = "COURSE", fallbackFactory = RemoteCourseServiceFactory.class)//指定回调工厂
public interface RemoteCourseService {
    /**
     * @date:10:11 2020/7/20
     * @description:按条件分页查询课程
     * @params:
     * @return:
     * @author 吴毛伟
     */
    @RequestMapping("/condition")
    public ResponseEntity<PageBean<CourseDto>> queryCoursesByCondition(@RequestBody CourseDto courseDto);

    @GetMapping("/all")
    public ResponseEntity<List<CourseCategory>> findAllCategories();

    @GetMapping("/findChapterByCid/{cid}")
    public ResponseEntity<List<CourseChapter>> findChapterByCid(@PathVariable("cid") int cid);

    @GetMapping("/findCoursewares/{cpid}")
    public ResponseEntity<List<Courseware>> findCoursewaresByCpid(@PathVariable("cpid") int cpid);

    @GetMapping("/allTeachers")
    public ResponseEntity<List<Teacher>> findAllTeachers();

    @GetMapping("/findByCid/{cid}")
    public ResponseEntity<Course> findCourseByCid(@PathVariable("cid") int cid);

    @RequestMapping("/courseware/findCoursewareByCwid")
    public ResponseEntity findCoursewareByCwid(@RequestBody Courseware courseware);
}
